package com.temp.controller.user;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.temp.entity.SystemSetting;
import com.temp.result.Result;
import com.temp.service.SystemSettingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/system")
@Api(tags = "系统相关接口")
@Slf4j
@Validated
public class SysSettingController {

    @Autowired
    private SystemSettingService settingService;

    @GetMapping("/query")
    @ApiOperation("获取默认系统设置")
    public Result getDefaultSystem(@RequestParam String key) {
        SystemSetting one = settingService.getOne(Wrappers.<SystemSetting>lambdaQuery().in(SystemSetting::getSettingKey, key));
        return Result.success(one,"apiMsg.querySuccess");
    }
}
